package leetcode.primary;

public class T300 {
    public int lengthOfLIS(int[] nums) {
        int[] length = new int[nums.length];
        int maxLength=1;

        length[nums.length-1] = 1;
        for (int i = nums.length-2; i>=0; i--) {
            int temp=1;
            for (int j = i+1; j < nums.length ; j++) {
                if (nums[i]<nums[j] && temp<length[j]+1){
                    temp = length[j]+1;
                }
            }
            length[i] = temp;
            if (maxLength<temp){
                maxLength = temp;
            }
        }

        return maxLength;
    }

    public static void main(String[] args) {
        T300 t300 = new T300();
        int length = t300.lengthOfLIS(new int[]{0,1,0,3,2,3});
        System.out.println(length);
    }
}
